package com.huilian.iotbox.data.enums;

import lombok.Getter;

import java.util.stream.Stream;

@Getter
public enum PermissionOpenSettingEnum {
    OPEN(1, "开放"),
    CLOSE(0, "不开放"),;

    private Integer code;
    private String desc;

    PermissionOpenSettingEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static PermissionOpenSettingEnum getPlatformType(Integer code) {
        return Stream.of(PermissionOpenSettingEnum.values())
                .filter(p -> p.code.equals(code))
                .findAny()
                .orElse(null);
    }
}
